package com.likui.myqq.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.RelativeLayout;

import com.likui.myqq.R;
import com.likui.myqq.view.TextURLView;

public class LoginActivity extends Activity {
    private Context mContext;
    private RelativeLayout rl_user;
    private Button mLogin;
    private Button register;
    private TextURLView mTextURLView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        mContext = this;
        findView();
        initTvUrl();
        init();
    }

    private void init() {
        Animation anim = AnimationUtils.loadAnimation(mContext, R.anim.login_anim);
        anim.setFillAfter(true);
        rl_user.setAnimation(anim);

        mLogin.setOnClickListener(loginClickListener);
        register.setOnClickListener(registerClickListener);
    }


    private void initTvUrl() {
        mTextURLView.setText(R.string.forget_password);
    }

    private void findView() {
        rl_user = (RelativeLayout) findViewById(R.id.rl_user);
        mLogin = (Button) findViewById(R.id.login);
        register = (Button) findViewById(R.id.register);
        mTextURLView = (TextURLView) findViewById(R.id.tv_forget_password);
    }

    private View.OnClickListener loginClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(mContext, MainActivity.class);
            startActivity(intent);
            finish();
        }
    };
    private View.OnClickListener registerClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(mContext, RegisterPhoneActivity.class);
            startActivity(intent);
        }
    };
}
